<template>
    <div>

        <el-table :data="buildingNumberList" border stripe @header-click="clickFun" style="width: 100%"
            :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"
            :span-method="objectSpanMethod">
            <el-table-column label="土地增值税清算结果表（汇总）">

                <el-table-column prop="num" label="行号">
                </el-table-column>
                <el-table-column label="项目">
                    <el-table-column prop="title_1">
                    </el-table-column>

                    <el-table-column prop="title_2">
                    </el-table-column>
                </el-table-column>
                <el-table-column prop="residence" label="普通住宅">
                </el-table-column>
                <el-table-column prop="nresidence" label="非普通住宅">
                </el-table-column>
                <el-table-column prop="qita" label="其他">
                </el-table-column>
                <el-table-column prop="sum" label="总计：元（列至角分）">
                </el-table-column>


            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import calculateApi from '@/api/calculate'

export default {
    data() {
        return {
            calculate_id: '',
            buildingNumberList: [],
            shuilvList: [],
            sumList: [],
        }

    },
    methods: {
        getCalculateBuildingNumberList() {
            calculateApi.getCalculateBuildingNumberList(this.calculate_id).then(response => {
                this.buildingNumberList = response.data.huiZongList;
            })
        },


        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            if (columnIndex === 1) {
                //横向合并单元格
                if (rowIndex === 0 || rowIndex === 4 || rowIndex === 5 || rowIndex === 6 || rowIndex === 13 || rowIndex === 16 || rowIndex > 20) {
                    return [1, 2];
                } else if (rowIndex === 1) {
                    //纵向合并单元格
                    return [3, 1];
                } else if (rowIndex === 2 || rowIndex === 3) {
                    //消除纵向合并原内容
                    return [0, 0];
                } else if (rowIndex === 7) {
                    return [6, 1];
                } else if (rowIndex === 8 || rowIndex === 9 || rowIndex === 10 || rowIndex === 11 || rowIndex === 12) {
                    return [0, 0];
                } else if (rowIndex === 14) {
                    return [2, 1];
                } else if (rowIndex === 15) {
                    return [0, 0];
                } else if (rowIndex === 17) {
                    return [4, 1];
                } else if (rowIndex === 18 || rowIndex === 19 || rowIndex === 20) {
                    return [0, 0];
                }
            }

            //消除横向合并原内容
            if (columnIndex === 2) {
                if (rowIndex === 0 || rowIndex === 4 || rowIndex === 5 || rowIndex === 6 || rowIndex === 13 || rowIndex === 16 || rowIndex > 20) {
                    return [0, 0];
                }
            }


        },
    },
    created() {
        var query = this.$route.query;
        if (query.id) {
            this.calculate_id = query.id;
        }

        this.getCalculateBuildingNumberList();
    },
}
</script>

<style></style>